using System.Data;

namespace GTask
{
    /// <summary>
    /// 任务队列类
    /// </summary>
    public class TaskProcessItem
    {
        /// <summary>
        /// 队列编号
        /// </summary>
        public string PROCESS_ID = "";
        /// <summary>
        /// 队列名称
        /// </summary>
        public string PROCESS_NAME = "";
        /// <summary>
        /// 最大线程数
        /// </summary>
        public int MAX_THREAD_COUNT = 0;
        /// <summary>
        /// 等待队列
        /// </summary>
        public TaskItemCollection WAIT_LIST = new TaskItemCollection();
        /// <summary>
        /// 执行队列
        /// </summary>
        public TaskItemCollection EXEC_LIST = new TaskItemCollection();
        /// <summary>
        /// 数据行
        /// </summary>
        public DataRow DATA_ROW = null;
        /// <summary>
        /// 初始化类的新实例
        /// </summary>
        /// <param name="dr">数据</param>
        public TaskProcessItem(DataRow dr)
        {
            DATA_ROW = dr;
            PROCESS_ID = dr["PROCESS_ID"].ToString();
            PROCESS_NAME = dr["PROCESS_NAME"].ToString();
            MAX_THREAD_COUNT = int.Parse(dr["MAX_THREAD_COUNT"].ToString());
        }
        /// <summary>
        /// 等待任务数
        /// </summary>
        public int WaitTaskCount
        {
            get
            {
                return WAIT_LIST.Count;
            }
        }
        /// <summary>
        /// 执行任务数
        /// </summary>
        public int ExecTaskCount
        {
            get
            {
                return EXEC_LIST.Count;
            }
        }
    }
}
